// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import {ajax} from './common'
import Navigation from 'vue-navigation'
import toast from './components/toast'
import dialog from './components/dialog'
import load from './components/loading'
import Vant from 'vant';
import 'vant/lib/index.css';
import './assets/font/iconfont.css'
import 'lib-flexible'

Vue.prototype.$http = ajax;

Vue.use(Navigation, {router})
   .use(dialog)
   .use(toast)
   .use(load)
   .use(Vant)

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App },
  watch: {
    '$route.path': function (newVal, oldVal) {
      if (process.env.NODE_ENV === 'production') {
        this.$nextTick(() => {
          elementAddEventListener();
        });

        loadEventPush(window.location.pathname, oldVal, this.$route.query);
      }
    }
  }
});
